<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>var词法环境</title>
</head>
<body>
<script>
    var globalNinja = 'Yoshi';

    function reportActivity() {
        var functionActivity = 'jumping';
        for (var i = 0; i < 3; i++) {
            var forMessage = globalNinja + ' ' + functionActivity;
        }
        console.log(forMessage);
    }
    reportActivity();
    // console.log(forMessage);  // var 定义的变量总是存在于最近的函数内部或者全局词法环境
</script>
</body>
</html>
